import { Button } from 'antd';
import React from 'react';
import { useAuth } from '@/store/modules/auth';
import { useHasButtonAuth } from '../hooks/permissions';

const AuthButton = ({ code, children, ...props }) => {
  const hasPermission = useHasButtonAuth(code);
  if (!hasPermission) return null;
  return <Button {...props}>{children}</Button>;
};

export default React.memo(AuthButton);
